package colecoes;

import interfaces.InterfaceLogin;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import basicas.Login;
import fachada.JDBC;

public class ColLogin implements InterfaceLogin{

	public Login consultaLoginSenha(String login, String senha) 
	throws ClassNotFoundException, SQLException{
		String sql = "SELECT *FROM pessoa WHERE login = " +login+" and senha = "+senha+";";
		Statement conexao = JDBC.getsStatement();
		ResultSet resultado = conexao.executeQuery(sql);
		
		while (resultado.next()) {
			Login log = new Login();
			log.setLogin(resultado.getString("login"));
			log.setSenha(resultado.getString("senha"));
			return log;
		}
		conexao.close();
		return null;
	}
	
	
}
